home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / PROC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-28  |  1.9 KB  |  66 lines

  1. #ifndef    PHASH
  2.  
  3. #include <setjmp.h>
  4. #include "timer.h"
  5.  
  6. /* Kernel process control block */
  7. #define    PHASH    17        /* Number of wait table hash chains */
  8. struct proc {
  9.     struct proc *prev;    /* Process table pointers */
  10.     struct proc *next;    
  11.  
  12.     jmp_buf env;        /* Process state */
  13.     char i_state;        /* Process interrupt state */
  14.  
  15.     unsigned short state;
  16. #define    READY    0
  17. #define    WAITING    1
  18. #define    SUSPEND    2
  19.     void *event;        /* Wait event */
  20.     int16 *stack;        /* Process stack */
  21.     unsigned stksize;    /* Size of same */
  22.     char *name;        /* Arbitrary user-assigned name */
  23.     int retval;        /* Return value from next pwait() */
  24.     struct timer alarm;    /* Alarm clock timer */
  25. };
  26. #define NULLPROC (struct proc *)0
  27. extern struct proc *Waittab[];    /* Head of wait list */
  28. extern struct proc *Rdytab;    /* Head of ready list */
  29. extern struct proc *Curproc;    /* Currently running process */
  30. extern struct proc *Susptab;    /* Suspended processes */
  31. extern int Stkchk;        /* Stack checking flag */
  32.  
  33. #if    defined(__STDC__) || defined(__TURBOC__)
  34. struct proc *newproc(char *name,unsigned int stksize,void (*pc)(),
  35.     int iarg,void *parg1,void *parg2);
  36. struct proc *mainproc(char *name);
  37. void killself(void);
  38. void killproc(struct proc *pp);
  39. void psignal(void *event,int n);
  40. void chkstk(void);
  41. void suspend(struct proc *pp);
  42. void resume(struct proc *pp);
  43. void alert(struct proc *pp,int val);
  44. int pwait(void *event);
  45. void chname(struct proc *pp,char *newname);
  46. void psetup(struct proc *pp,int iarg,void *parg1,void *parg2,void (*pc)());
  47. #else
  48. struct proc *newproc(),*mainproc();
  49. void killself(),killproc(),psignal(),chkstk();
  50. void suspend();
  51. void resume();
  52. void alert();
  53. int pwait();
  54. void chname();
  55. void psetup();
  56. #endif
  57. int ps();
  58.  
  59. /* Stack background fill value for high water mark checking */
  60. #define    STACKPAT    0x55aa
  61.  
  62. /* Value stashed in location 0 to detect null pointer dereferences */
  63. #define    NULLPAT        0xdead
  64.  
  65. #endif    /* PHASH */
  66.